package com.lc.dao;

import java.util.List;

import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.lc.model.User;

public class UserMapperTestInSpring {

	private static ClassPathXmlApplicationContext context = null;
	private static UserMapper userMapper;

	static {
		context = new ClassPathXmlApplicationContext("com/lc/config/spring-config.xml");
		context.start();
		userMapper = context.getBean(UserMapper.class);
	}

	@Test
	public void select() {
		List<User> userlist = userMapper.select();
		for (User user : userlist) {
			System.out.println(user);
		}
	}

	@Test
	public void delete() {
		if (userMapper.delete(1) > 0) {
			System.out.println("del success");
		}
	}
}